#!/bin/bash
# passer en parametre l'url de l'instance a éteindre


export EC2_PRIVATE_KEY=pk-OYYLKCVZFZW3LQTNV7KSPOYAHMXRTA2K.pem
export EC2_CERT=cert-OYYLKCVZFZW3LQTNV7KSPOYAHMXRTA2K.pem

i=$(ec2-describe-instances | grep "$1" | grep "INSTANCE" | head -n 1 | cut -d$'\t' -f2 | sed -e "s/[\t]/ /g" )

echo stopping $i

ec2-terminate-instances $i


